|
|
|
|
|
|
|
1. What are the three main parts of error handlers in Visual Basic? |
|
|
|
|
|
|
|
|
2. What are the four ways to exit an error handler routine? |
|
|
|
|
|
|
|
|
3. When would you use Resume to exit an error handler? |
|
|
|
|
|
|
|
|
4. When would you use Resume Next to exit an error handler? |
|
|
|
|
|
|
|
|
5. When would you use Resume label to exit an error handler? |
|
|
|
|
|
|
|
|
6. When would you use the EXIT or END command to exit an error handler? |
|
|
|
|
|
|
|
|
7. List the four types of Visual Basic errors. |
|
|
|
|
|
|
|
|
8. Should you use error trapping for the Visual Basic data control? |
|
|
|
|
|
|
|
|
9. In what Visual Basic event should you open data tables or files in which the user enters data? |
|
|
|
|
|
|
|
|
10. What are the advantages and disadvantages of global error handlers? |
|
|
|
|
|
|
|
|
11. What is the Err.Raise method and why is it useful? |
|
|
|
|
|
|
|
|
1. Create a new project and add code to a command button that opens the file C:\ABC.TXT. Include an error handler that notifies the user that the file cannot be opened, and then terminates the program. |
|
|
|
|
|
|
|
|
2. Modify the project started in Exercise 1 by adding a new command button. Attach code to this button that attempts to load a file named C:\ABC.TXT. Notify the user that this file cannot be opened, and give the user the option and the dialog box to search for the file. Exit the program when a selection has been made or if the user chooses not to proceed. |
|
|
|
|
|
|
|
|
Run this program and elect to find the file. Cancel out of any common dialogs that appear. After this, create the file using Notepad and run the process again. Finally, move the file to a location other than the C drive and run the program. Use the common dialog to search for and select the file. |
|
|
|
|
|